$(function () {
    //绑定手机号
    $("body").on('click','#sendRandInfor',function () {//发送短信验证码
        var _that = this;
        disabledSend(_that);
        var mobile = $("input[name='userInfoMobile']").val();
        sendCode(mobile,5,function () {
            $(_that).hide();
            $("#noSendRandInfor").show();
            $("#noSendRandInfor").text('(60s)获取验证码');
            var time = 60;
            var inter = setInterval(function () {
                time --;
                if(time<=0){
                    window.clearInterval(inter);
                    $(_that).show();
                    $("#noSendRandInfor").hide();
                    $("#noSendRandInfor").text('获取验证码');
                    relieveSend(_that);
                }else{
                    $("#noSendRandInfor").text('('+time+'s)获取验证码');
                }
            },1000);
        },_that);
    }).on('click','#successNext',function () {//完成下一步
        var mobile = $("input[name='userInfoMobile']").val();
        var mobileCode = $("input[name='userInfoCode']").val();
        $.ajax({
            url:baseloaction +'/web/user/setUserMobile',
            type:'post',
            dataType:'json',
            data:{
                'sessionId':key,
                'mobile':mobile,
                'mobileCode':mobileCode,
                'autoThirty':autoThirty
            },
            success:function (result) {
                if(result.success==true){
                    var _url = result.url;
                    if(_url==null || $.trim(_url)==''){
                        window.location.href = baseloaction +'/web/uc/course/user/index';
                    }else{
                        window.location.href =baseloaction + _url;
                    }
                }else{
                    if(result.FROZEN==true){
                        window.location.href =baseloaction + '/web/user/login?message='+result.message
                    }else{
                        icModale(0,'',result.message);
                    }
                }
            },
            error:function (error) {
                icModale(0,'','系统错误，完善资料失败');
            }
        });
    });
});